<template>
	<view class="reference" @tap="open">
		<uni-popup ref="tree_popup" type="center" :mask-click="false" :animation="true">
			<view class="tree_popup_view">
				<image @tap="closepups" class="closeicon" :src="photo_cdn+'zpupload/static/icon/closeicon.png'" mode=""></image>
				<view v-if="signal==1" class="operation">
					
					
					<view class="lable_cell_items">
						<view class="lable_names">族谱口令</view>
						<view class="lable_input_view">
							<input class="lable_input_tag" type="text" value="" v-model="card_number"placeholder="请输入查看族谱口令"></input>
						</view>
					</view>
					<view class="sub_footbtn" @tap="reference">
						<view class="sub_button">确认查询</view>
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import config from "@/utils/config.js";
	let {staticurl,photo_cdn} = config.baseUrl;
	import {claimFamilyPeople} from "@/utils/api/zupu.js";
	export default{
		props:{
			source_type:{//来源 3 默认  2 姓名卡
				type:[String,Number],
				default:"3",
			},
			//族谱id
			family_id:{
				type:[String,Number],
				default:"",
			},
			activation_code:{//激活码 自动输入的
				type:[String,Number],
				default:"",
			}
		},
		data(){
			return{
				photo_cdn,
				card_number:"",//激活卡的卡号
				people_id:'',
				current: 0, //单选框
				signal: 1, //弹窗显示  1是输入爷爷爸爸自己名字  2是选结果
				grandpa_name: '', //爷爷姓名
				parent_name: '', //父亲姓名
				name: '', //自己姓名
				claim_info: [],
			}
		},
		methods:{
			open(){
				// if(this.activation_code){
				// 	this.card_number = this.activation_code;//自动输入内容
				// }
				
				this.$refs.tree_popup.open();
			},
			//关闭弹窗
			closepups(){
				this.$refs.tree_popup.close();
				setTimeout(()=>{
					this.signal=1;
					this.grandpa_name='';
					this.parent_name='';
					this.name='';	
				},500)	
			},
			//根据祖孙三代人的信息查询成员
			reference() {
				
				if (this.card_number == '') {
					this.$api.msg("密码口令不得为空!");
					return false;
				}
				
				if (this.card_number !=  this.activation_code){
					this.$api.msg("口令密码错误！");
					return false;
				}
				
				uni.navigateTo({
					url: `/pages/zupu/familytrees/familytrees?family_id=${this.family_id}&code=${this.card_number}`
				})
			},
		}
	}
</script>

<style lang="scss">
	@import "./references.scss"
</style>